package acm.蓝桥13;

import java.util.Scanner;

public class D子矩阵 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        int m=sc.nextInt();
        int k=sc.nextInt();
        int[][] sum=new int[n+1][m+1];
        for (int i = 1; i < sum.length; i++) {
            for (int j = 1; j < sum[0].length; j++) {
                sum[i][j]=sc.nextInt();
                sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
            }
        }
        int res=0;
        for (int sx = 1; sx <= n; sx++) {
            for (int sy = 1; sy <= m; sy++) {
                for (int ex = sx; ex <= n; ex++) {
                    for (int ey = sy; ey <= m; ey++) {
                        int cur=sum[ex][ey]-sum[ex][sy-1]-sum[sx-1][ey]+sum[sx-1][sy-1];
                        if (cur<=k){
                            res++;
                        }else {
                            break;
                        }
                    }
                }
            }
        }
        System.out.println(res);
    }
}
